<?php
require_once('Extension/View/Helper/Abstract.php');

class Extension_View_Helper_CUR extends Extension_View_Helper_Abstract
{
    protected $_currency = null;

    public function init()
    {
        $this->_currency = new Zend_Currency();
        // no need since 1.7.0 if Zend_Registry::isRegistered('Zend_Locale')
        //$this->_currency->setLocale(Kbs::initLocale());
    }

    public function CUR($value, $options = array())
    {
        $cur = $this->_currency;
        $cur->setFormat($options);
        $result = $cur->toCurrency($value);

        /*
        echo 'symbol : ' . $cur->getSymbol() . '<br />';
        echo 'ShortName : ' . $cur->getShortName() . '<br />';
        echo 'Name : ' . $cur->getName() . '<br />';
        echo 'RegionList : ' . nl2br(print_r($cur->getRegionList(), true)) . '<br />';
        echo 'CurrencyList : ' . nl2br(print_r($cur->getCurrencyList(), true)) . '<br />';
        */

        return $result;
    }
}